﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
using System.IO;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;  


namespace community
{
    public partial class printFM : Form
    {
        public printFM()
        {
            InitializeComponent();
        }

        private void printFM_Load(object sender, EventArgs e)
        {
            string  strSql="select inhabitantcode_chr,residentname_chr,phone_chr,registaddress_vchr,";
            strSql += "addressprovince_vchr,addresscity_vchr,addresscounty_vchr,addressvillage_vchr,addresshamlet_vchr,";
            strSql += "addressdoorplate_vchr ,createdoctor_chr, createunit_vchr,createdate_dat,recorder_chr";
            strSql += "   from  T_CS_INHABITANTRECORD_NEW  where inhabitantcode_chr='" + residentcode.rescode + "'";
            Cryfm cfm = new Cryfm();
            DataSet ds = new DataSet();
            SqlConnection conn = new SqlConnection(SQL.conStr);
            conn.Open();
            SqlDataAdapter dap = new SqlDataAdapter(strSql, conn);
            try
            {

                dap.Fill(ds,"T_CS_INHABITANTRECORD_NEW");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            cfm.SetDataSource(ds.Tables[0]);
            this.fmrep.ReportSource = cfm;
            conn.Close();
             
        }
    }
}
